﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Container.Library;
using Microsoft.AspNetCore.Mvc;
using Project.Logic;
using Project.Model;
using Tool.Model;
using Web.Manage.App_Start;

namespace Web.Manage.Areas.Staff.Controllers
{
    /// <summary>
    /// 员工打卡记录
    /// </summary>
    [Area("Staff")]
    public class ClockOnController : BaseController
    {
        private readonly IEmployeeService employeeService = null;//员工管理逻辑
        public ClockOnController()
        {
            //员工管理逻辑注入
            employeeService = UnityCIContainer.Instance.GetService<IEmployeeService>();
        }

        #region 界面

        [UserAuthorization(true, FunctionValidateType.VerifyView)]
        public IActionResult Index()
        {
            return View();
        }

        #endregion

        #region 查询
        /// <summary>
        /// 获取打卡记录分页列表
        /// </summary>
        /// <returns></returns>
        [UserAuthorization(true, FunctionValidateType.VerifyLoggedIn)]
        public ActionResult LoadRecordList()
        {
            var resultInfo = new ResultJsonInfo<List<Dictionary<string, object>>>();
            try
            {
                //实体接收数据
                var parametersInfo = DeserializeRequestData<ParametersInfo<MapAttendQueryRequest>>();
               
                resultInfo = employeeService.LoadMapAttendList(parametersInfo);
            }
            catch (Exception ex)
            {
                resultInfo.Success = false;
                resultInfo.Msg = ex.Message;
                resultInfo.Excep = ex;
            }
            return ReturnContent(resultInfo);
        }
        #endregion

    }
}